package com.zhang.server.mapper;

import com.zhang.server.controller.request.UserPageRequest;
import com.zhang.server.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
//import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {
//    @Select("select * from user;")
    List<User> list();

    List<User> listByCondition(UserPageRequest userPageRequest);

    // 生成用户表测试数据
    @Insert("insert into user (name, username, age, sex, phone, address) values (#{name}, #{username}, #{age}, #{sex}, #{phone}, #{address})")
    Integer insertTestData(User user);

    Integer save(User user);

    User getById(Integer id);

    void update(User user);

    void delete(Integer id);

    User getByUsername(String username);
}
